'use strict';

const ref = require('ref-napi');
const StructType = require('ref-struct-napi');
const ArrayType = require('ref-array-napi');
const mError = module.exports = {};

mError.Ref = ref;
mError.Struct = StructType;
mError.Array = ArrayType;

mError.MERR_NONE = 0x0;
mError.MOK = 0x0;

mError.MERR_BASIC_BASE = 0X0001;                                        //通用错误类型
mError.MERR_UNKNOWN                  = mError.MERR_BASIC_BASE;          //错误原因不明
mError.MERR_INVALID_PARAM            = mError.MERR_BASIC_BASE+1;        //无效的参数
mError.MERR_UNSUPPORTED              = mError.MERR_BASIC_BASE+2;        //引擎不支持
mError.MERR_NO_MEMORY                = mError.MERR_BASIC_BASE+3;        //内存不足
mError.MERR_BAD_STATE                = mError.MERR_BASIC_BASE+4;        //状态错误
mError.MERR_USER_CANCEL              = mError.MERR_BASIC_BASE+5;        //用户取消相关操作
mError.MERR_EXPIRED                  = mError.MERR_BASIC_BASE+6;        //操作时间过期
mError.MERR_USER_PAUSE               = mError.MERR_BASIC_BASE+7;        //用户暂停操作
mError.MERR_BUFFER_OVERFLOW          = mError.MERR_BASIC_BASE+8;        //缓冲上溢
mError.MERR_BUFFER_UNDERFLOW         = mError.MERR_BASIC_BASE+9;        //缓冲下溢
mError.MERR_NO_DISKSPACE             = mError.MERR_BASIC_BASE+10;       //存贮空间不足
mError.   MERR_COMPONENT_NOT_EXIST   = mError.MERR_BASIC_BASE+11;       //组件不存在
mError.   MERR_GLOBAL_DATA_NOT_EXIST = mError.MERR_BASIC_BASE+12;       //全局数据不存在

mError.MERR_FSDK_BASE                         = 0x7000;                       //Free SDK通用错误类型
mError.MERR_FSDK_INVALID_APP_ID               = mError.MERR_FSDK_BASE + 1;    //无效的App Id
mError.MERR_FSDK_INVALID_SDK_ID               = mError.MERR_FSDK_BASE + 2;    //无效的SDK key
mError.MERR_FSDK_INVALID_ID_PAIR              = mError.MERR_FSDK_BASE + 3;    //AppId和SDKKey不匹配
mError.MERR_FSDK_MISMATCH_ID_AND_SDK          = mError.MERR_FSDK_BASE + 4;    //SDKKey 和使用的SDK 不匹配
mError.MERR_FSDK_SYSTEM_VERSION_UNSUPPORTED   = mError.MERR_FSDK_BASE + 5;    //系统版本不被当前SDK所支持
mError.MERR_FSDK_LICENCE_EXPIRED              = mError.MERR_FSDK_BASE + 6;    //SDK有效期过期，需要重新下载更新

mError.MERR_FSDK_FR_ERROR_BASE                = 0x12000 ;                             //Face Recognition错误类型
mError.MERR_FSDK_FR_INVALID_MEMORY_INFO       = mError.MERR_FSDK_FR_ERROR_BASE + 1;   //无效的输入内存
mError.MERR_FSDK_FR_INVALID_IMAGE_INFO        = mError.MERR_FSDK_FR_ERROR_BASE + 2;   //无效的输入图像参数
mError.MERR_FSDK_FR_INVALID_FACE_INFO         = mError.MERR_FSDK_FR_ERROR_BASE + 3;   //无效的脸部信息
mError.MERR_FSDK_FR_NO_GPU_AVAILABLE          = mError.MERR_FSDK_FR_ERROR_BASE + 4;   //当前设备无GPU可用
mError.MERR_FSDK_FR_MISMATCHED_FEATURE_LEVEL  = mError.MERR_FSDK_FR_ERROR_BASE + 5;   //待比较的两个人脸特征的版本不一致


mError.MERR_FSDK_FACEFEATURE_ERROR_BASE           = 0x14000;                                       //人脸特征检测错误类型
mError.MERR_FSDK_FACEFEATURE_UNKNOWN              = mError.MERR_FSDK_FACEFEATURE_ERROR_BASE + 1;   //人脸特征检测错误未知
mError.MERR_FSDK_FACEFEATURE_MEMORY               = mError.MERR_FSDK_FACEFEATURE_ERROR_BASE + 2;   //人脸特征检测内存错误
mError.MERR_FSDK_FACEFEATURE_INVALID_FORMAT       = mError.MERR_FSDK_FACEFEATURE_ERROR_BASE + 3;   //人脸特征检测格式错误
mError.MERR_FSDK_FACEFEATURE_INVALID_PARAM        = mError.MERR_FSDK_FACEFEATURE_ERROR_BASE + 4;   //人脸特征检测参数错误
mError.MERR_FSDK_FACEFEATURE_LOW_CONFIDENCE_LEVEL = mError.MERR_FSDK_FACEFEATURE_ERROR_BASE + 5;   //人脸特征检测结果置信度低

mError.MERR_ASF_EX_BASE                            = 0x15000;                            //ASF错误类型
mError.MERR_ASF_EX_FEATURE_UNSUPPORTED_ON_INIT     = mError.MERR_ASF_EX_BASE + 1;        //Engine不支持的检测属性
mError.MERR_ASF_EX_FEATURE_UNINITED                = mError.MERR_ASF_EX_BASE + 2;        //需要检测的属性未初始化
mError.MERR_ASF_EX_FEATURE_UNPROCESSED             = mError.MERR_ASF_EX_BASE + 3;        //待获取的属性未在process中处理过
mError.MERR_ASF_EX_FEATURE_UNSUPPORTED_ON_PROCESS  = mError.MERR_ASF_EX_BASE + 4;        //PROCESS不支持的检测属性组合，例如FR，有自己独立的处理函数
mError.MERR_ASF_EX_INVALID_IMAGE_INFO              = mError.MERR_ASF_EX_BASE + 5;        //无效的输入图像
mError.MERR_ASF_EX_INVALID_FACE_INFO               = mError.MERR_ASF_EX_BASE + 6;        //无效的脸部信息

mError.MERR_ASF_BASE                                = 0x16000;                        //人脸比对基础错误类型
mError.MERR_ASF_ACTIVATION_FAIL                     = mError.MERR_ASF_BASE + 1;       //SDK激活失败,请打开读写权限
mError.MERR_ASF_ALREADY_ACTIVATED                   = mError.MERR_ASF_BASE + 2;       //SDK已激活
mError.MERR_ASF_NOT_ACTIVATED                       = mError.MERR_ASF_BASE + 3;       //SDK未激活
mError.MERR_ASF_SCALE_NOT_SUPPORT                   = mError.MERR_ASF_BASE + 4;       //detectFaceScaleVal 不支持
mError.MERR_ASF_ACTIVEFILE_SDKTYPE_MISMATCH         = mError.MERR_ASF_BASE + 5;       //激活文件与SDK类型不匹配，请确认使用的sdk
mError.MERR_ASF_DEVICE_MISMATCH                     = mError.MERR_ASF_BASE + 6;       //设备不匹配
mError.MERR_ASF_UNIQUE_IDENTIFIER_ILLEGAL           = mError.MERR_ASF_BASE + 7;       //唯一标识不合法
mError.MERR_ASF_PARAM_NULL                          = mError.MERR_ASF_BASE + 8;       //参数为空
mError.MERR_ASF_LIVENESS_EXPIRED                    = mError.MERR_ASF_BASE + 9;       //活体已过期
mError.MERR_ASF_VERSION_NOT_SUPPORT                 = mError.MERR_ASF_BASE + 10;       //版本不支持
mError.MERR_ASF_SIGN_ERROR                          = mError.MERR_ASF_BASE + 11;       //签名错误
mError.MERR_ASF_DATABASE_ERROR                      = mError.MERR_ASF_BASE + 12;       //激活信息保存异常
mError.MERR_ASF_UNIQUE_CHECKOUT_FAIL                = mError.MERR_ASF_BASE + 13;       //唯一标识符校验失败
mError.MERR_ASF_COLOR_SPACE_NOT_SUPPORT             = mError.MERR_ASF_BASE + 14;       //颜色空间不支持
mError.MERR_ASF_IMAGE_WIDTH_HEIGHT_NOT_SUPPORT      = mError.MERR_ASF_BASE + 15;       //图片宽高不支持，宽度需四字节对齐

mError.MERR_ASF_BASE_EXTEND                         = 0x16010;                            //人脸比对基础错误类型
mError.MERR_ASF_READ_PHONE_STATE_DENIED             = mError.MERR_ASF_BASE_EXTEND + 1;    //android.permission.READ_PHONE_STATE权限被拒绝
mError.MERR_ASF_ACTIVATION_DATA_DESTROYED           = mError.MERR_ASF_BASE_EXTEND + 2;    //激活数据被破坏,请删除激活文件，重新进行激活
mError.MERR_ASF_SERVER_UNKNOWN_ERROR                = mError.MERR_ASF_BASE_EXTEND + 3;    //服务端未知错误
mError.MERR_ASF_INTERNET_DENIED                     = mError.MERR_ASF_BASE_EXTEND + 4;    //INTERNET权限被拒绝
mError.MERR_ASF_ACTIVEFILE_SDK_MISMATCH             = mError.MERR_ASF_BASE_EXTEND + 5;    //激活文件与SDK版本不匹配,请重新激活
mError.MERR_ASF_DEVICEINFO_LESS                     = mError.MERR_ASF_BASE_EXTEND + 6;    //设备信息太少，不足以生成设备指纹
mError.MERR_ASF_LOCAL_TIME_NOT_CALIBRATED           = mError.MERR_ASF_BASE_EXTEND + 7;    //客户端时间与服务器时间（即北京时间）前后相差在30分钟以上
mError.MERR_ASF_APPID_DATA_DECRYPT                  = mError.MERR_ASF_BASE_EXTEND + 8;    //数据校验异常
mError.MERR_ASF_APPID_APPKEY_SDK_MISMATCH           = mError.MERR_ASF_BASE_EXTEND + 9;    //传入的AppId和AppKey与使用的SDK版本不一致
mError.MERR_ASF_NO_REQUEST                          = mError.MERR_ASF_BASE_EXTEND + 10;    //短时间大量请求会被禁止请求,30分钟之后解封
mError.MERR_ASF_ACTIVE_FILE_NO_EXIST                = mError.MERR_ASF_BASE_EXTEND + 11;    //激活文件不存在
mError.MERR_ASF_DETECT_MODEL_UNSUPPORTED            = mError.MERR_ASF_BASE_EXTEND + 12;    //检测模型不支持，请查看对应接口说明，使用当前支持的检测模型
mError.MERR_ASF_CURRENT_DEVICE_TIME_INCORRECT       = mError.MERR_ASF_BASE_EXTEND + 13;    //当前设备时间不正确，请调整设备时间

mError.MERR_ASF_NETWORK_BASE                        = 0x17000;                             //网络错误类型
mError.MERR_ASF_NETWORK_COULDNT_RESOLVE_HOST        = mError.MERR_ASF_NETWORK_BASE + 1;    //无法解析主机地址
mError.MERR_ASF_NETWORK_COULDNT_CONNECT_SERVER      = mError.MERR_ASF_NETWORK_BASE + 2;    //无法连接服务器
mError.MERR_ASF_NETWORK_CONNECT_TIMEOUT             = mError.MERR_ASF_NETWORK_BASE + 3;    //网络连接超时
mError.MERR_ASF_NETWORK_UNKNOWN_ERROR               = mError.MERR_ASF_NETWORK_BASE + 4;    //网络未知错误




